/*
 * Copyright © 2017 eqxiu.com 北京中网易企秀科技有限公司  All rights reserved.
 */
package cn.hermit.data.xml.handler;

import javax.xml.namespace.QName;

/**
 * XML streaming API in SAX syntax
 * 
 * @author Jack Gao (Chinese name : GAO JIANGUO, Email : linux.gjg@gmail.com)
 * @date 19 Jun, 2014
 */
public interface ContentHandler {
    
	/**
	 * Invoked when the parser walks in XML document.
	 */
    void startDocument();

	/**
	 * Invoked when the parser walks in version in header.
	 * 
	 * @param version
	 * 		XML version
	 */
	void version(String version);

	/**
	 * Invoked when the parser walks in encoding in header.
	 * 
	 * @param version
	 * 		XML encoding
	 */
	void encoding(String encoding);
	
	/**
	 * Invoked when the parser walks in XML standalone attribute in header.
	 * 
	 * @param standalone
	 * 		XML standalone attribute in header
	 */
	void standalone(String standalone);

	/**
	 * Invoked when the parser walks in an element.
	 * 
	 * @param name
	 * 		QName of element
	 * @param closedTag
	 * 		If true, the element should be a closed-tag element without children
	 */
	void startElement(QName name, boolean closedTag);

	/**
	 * Invoked when the parser walks in a attribute in element tag.
	 * 
	 * @param name
	 * 		QName of attribute
	 * @param value
	 * 		Attribute value
	 */
	void attribute(QName name, String value);

	/**
	 * Invoked when the parser walks in a text node.
	 * 
	 * @param content
	 * 		Content of text node
	 */
	void text(String content);

	/**
	 * Invoked when the parser walks in a CDATA node.
	 * 
	 * @param content
	 * 		Content of CDATA node
	 */
	void cdata(String content);

	/**
	 * Invoked when the parser walks in a comment node.
	 * 
	 * @param content
	 * 		Content of comment
	 */
	void comment(String content);

	/**
	 * Invoked when the parser finished walking in an element.
	 * 
	 * @param name
	 * 		QName of element
	 * @param closedTag
	 * 		If true, the element should be a closed-tag element without children
	 */
	void endElement(QName name,boolean closedTag);
	
	/**
	 * Invoke when the parser finished walking in XML Document.
	 */
	void endDocument();

}